package com.itheima.day08.Zuoye.Zuoye1;

import java.util.*;

public class Test {
    public static void main(String[] args) {
        Student2 s1 = new Student2("张三", 18, 175);
        Student2 s2 = new Student2("李四", 23, 180);
        Student2 s3 = new Student2("王五", 19, 166);
        Student2 s4 = new Student2("赵六", 19, 170);
        Student2 s5 = new Student2("孙七", 21, 180);
        Set<Student2> c = new TreeSet<>(( o1, o2)-> {
                if(o1.getAge() == o2.getAge()){
                    return o1.getScore()-o2.getScore();
                }else{
                    return o1.getAge()-o2.getAge();
                }
        });
        c.add(s1);
        c.add(s2);
        c.add(s3);
        c.add(s4);
        c.add(s5);
        System.out.println(c);
    }
}
